#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
	int result;
	opterr = 0;
	while((result = getopt(argc, argv, "hp:w::")) != -1)
	{
		printf("result: %d \n", result);
		switch(result)
		{
			case 'h':
				printf("h arg is %s \n", optarg);
				break;
			case 'p':
				printf("h arg is %s \n", optarg);
				break;
			case 'w':
				printf("h arg is %s \n", optarg);
				break;
		}
	}
	return 0;
}
